<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      let total = prompt("请输入银行卡的总额：");
      let electric = prompt("请输入本月花费的电费：");
      let water = prompt("请输入本月花费的水费：");
      let net = prompt("请输入本月花费的网费：");
      let balance = total - electric - water - net;
      document.write(` 
        <html>
        <style>
      h2 {
        text-align: center;
      }
      table {
        margin: 0 auto;
        width: 600px;
        height: 100px;
        text-align: center;
      }
      table,
      tr,
      td {
        border: 2px solid #ccc;
        border-collapse: collapse;
      }
      table tr:first-child {
        font-weight: 700;
       
      }
    </style>
  </head>
  <body>
    <div class="box">
      <h2>2020年12月消费支出</h2>
      <table>
        <tr>
          <td>银行卡余额</td>
          <td>水费</td>
          <td>电费</td>
          <td>网费</td>
          <td>银行卡余额</td>
        </tr>
        <tr>
          <td>${total}元</td>
          <td>${electric}元</td>
          <td>${water}元</td>
          <td>${net}元</td>
          <td>${balance}元</td>
        </tr>
      </table>
    </div>
  </body>
</html>`);
    </script>
  </body>
</html>
